1. Field of the Invention
The present invention relates to memory access, and more particularly, to an apparatus for monitoring a processor to access a memory and method thereof.
2. Description of the Prior Art
In general, a processor, for example, a central processing unit, not only can execute instructions but can also provide a function of monitoring memory access. The function of monitoring is used to determine an allowable pre-set range in the memory for access or an allowable operation in the memory for detecting abnormal access. This provides an advantage when debugging or preventing an incorrect program from affecting the system operation.
There are two common memory-access controlling methods in the conventional art. One memory access controlling method uses several watch registers in the processor for registering the status of one or more monitored ranges and operations in the memory, such as data-read, data-write or instruction-execution. If the status of the ranges and operations accessed by the processor both conform to the allowable ranges and allowable operations, a watch-point exception signal (i.e., exception signal) is generated and an exception handler is triggered by the watch-point exception signal to have the processor process the exception event in a predetermined way. This kind of memory access controlling method is adopted in the MIPS processor. The other common memory access controlling in the memory method also registers the status of one or more monitored ranges and operations for the memory. The difference with the above controlling method, however, is the condition for triggering the exception handler. Unlike the MIPS processor system, the exception handler is triggered under the condition that either the memory ranges accessed by the processor are not within the predetermined range stored in the registers, or the operations accessed by the processor do not conform to the predetermined operations. For example, an exception signal would be generated under the condition of writing to a read-only memory range. This kind of memory access controlling method is adopted in the ARM processor.
As both the above-mentioned memory access controlling methods have distinct criteria, the controlling method cannot be selected according to user requirements.